<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title>美家美货</title>
    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but 美家美货 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
    <script>
      function getParameterByName(name, url) {
        if (!url) url = window.location.href;
        /*eslint no-useless-escape: */
        name = name.replace(/[\[\]]/g, "\\$&");
        var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
            results = regex.exec(url);
        if (!results) return null;
        if (!results[2]) return '';
        return decodeURIComponent(results[2].replace(/\+/g, " "));
      }
      var token = getParameterByName('token')
      if (token) {
        sessionStorage.setItem('token', token)
      }
      var ismini = getParameterByName('ismini')
      if (ismini) {
        sessionStorage.setItem('isMini', ismini)
      }
      function htmlFontSize () {
        var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0)
        var width = w > 720 ? 720 : w
        var fz = ~~(width * 100000 / 36) / 10000
        var html = document.getElementsByTagName('html')[0]
        html.style.cssText = 'font-size: ' + fz + 'px'
        var realfz = ~~(+window.getComputedStyle(html).fontSize.replace('px', '') * 10000) / 10000
        if (fz !== realfz) {
          html.style.cssText = 'font-size: ' + fz * (fz / realfz) + 'px'
        }
      }
      wx.miniProgram.getEnv((res)=>{
         sessionStorage.setItem('isMini', res.miniprogram)
      })
      window.wx = wx
      window.onresize = function () { htmlFontSize() }
      window.onhashchange=function(event){
        console.log(event);
      }
    </script>
  </body>
</html>
